# coding=utf-8
import requests


url = 'https://www.baidu.com/s'
headers = {
    'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36'
}
# 方式1
rep = requests.get('https://www.baidu.com/s?ie=UTF-8&wd=中国', headers=headers)
# 方式2
params = {
    'ie': 'UTF-8',
    'wd': '中国'
}
rep = requests.get(url,params=params ,headers=headers)

print(rep.text)

rep.close()


